package com.shop.mms_client.db;

import android.content.Context;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import com.shop.mms_client.db.dao.MessageDao;
import com.shop.mms_client.db.dao.BlacklistDao;
import com.shop.mms_client.model.Message;
import com.shop.mms_client.model.BlacklistItem;

@Database(entities = {Message.class, BlacklistItem.class}, version = 1)
public abstract class AppDatabase extends RoomDatabase {
    private static volatile AppDatabase instance;

    public abstract MessageDao messageDao();
    public abstract BlacklistDao blacklistDao();

    public static synchronized AppDatabase getInstance(Context context) {
        if (instance == null) {
            instance = Room.databaseBuilder(
                context.getApplicationContext(),
                AppDatabase.class,
                "mms_database"
            ).build();
        }
        return instance;
    }
} 